package se.vgregion.icc.handlers;

import se.riv.itintegration.dependencies.v1.AbstractDependency;
import se.riv.itintegration.monitoring.pingforconfigurationresponder.v1.PingForConfigurationType;

/***
 * Interface to be implemented of all PingHandler implementations.
 * Implementations must be annotated with @PingDependencyHandler for it to work with spring.
 *
 * @author ricra2 & andan40
 * @see {@link se.vgregion.icc.handlers.annotations.PingDependencyHandler}
 */
public interface PingHandler {

    /***
     * Performs ping against the given dependency and returns response.
     * @param dependency to ping.
     * @param parameters information about already pinged dependencies.
     * @return String representation of PingForConfigurationResponse.
     */
    String preformPingAndReturnResponse(AbstractDependency dependency, PingForConfigurationType parameters);

    /***
     * Getter for the class that the PingHandler implementation can take care of.
     * This is needed for the PingHandlerRegistry to work.
     * @return the class of the dependency the PingHandler can ping against.
     */
    @SuppressWarnings("rawtypes")
    Class getHandledDependencyClass();

    /***
     * Marshal an object. 
     * 
     * @param responseType the object you like to marshal
     * @return the String that you marshal or empty String if something fails with the marshal
     */
    String marshal(Object responseType);
}
